/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.openbrew.openbrewrf;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "HopContract")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HopContract.findAll", query = "SELECT h FROM HopContract h"),
    @NamedQuery(name = "HopContract.findByHcid", query = "SELECT h FROM HopContract h WHERE h.hcid = :hcid"),
    @NamedQuery(name = "HopContract.findByHopContractC1", query = "SELECT h FROM HopContract h WHERE h.hopContractC1 = :hopContractC1"),
    @NamedQuery(name = "HopContract.findByHopContractC2", query = "SELECT h FROM HopContract h WHERE h.hopContractC2 = :hopContractC2"),
    @NamedQuery(name = "HopContract.findByHopContractC3", query = "SELECT h FROM HopContract h WHERE h.hopContractC3 = :hopContractC3"),
    @NamedQuery(name = "HopContract.findByHopContractC4", query = "SELECT h FROM HopContract h WHERE h.hopContractC4 = :hopContractC4"),
    @NamedQuery(name = "HopContract.findByContractLbsLeft", query = "SELECT h FROM HopContract h WHERE h.contractLbsLeft = :contractLbsLeft"),
    @NamedQuery(name = "HopContract.findByContractFinished", query = "SELECT h FROM HopContract h WHERE h.contractFinished = :contractFinished"),
    @NamedQuery(name = "HopContract.findByHopContractYear", query = "SELECT h FROM HopContract h WHERE h.hopContractYear = :hopContractYear")})
public class HopContract implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "HCID")
    private Integer hcid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "HopContractC1")
    private float hopContractC1;
    @Basic(optional = false)
    @NotNull
    @Column(name = "HopContractC2")
    private float hopContractC2;
    @Basic(optional = false)
    @NotNull
    @Column(name = "HopContractC3")
    private float hopContractC3;
    @Basic(optional = false)
    @NotNull
    @Column(name = "HopContractC4")
    private float hopContractC4;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ContractLbsLeft")
    private float contractLbsLeft;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ContractFinished")
    private boolean contractFinished;
    @Column(name = "HopContractYear")
    @Temporal(TemporalType.DATE)
    private Date hopContractYear;
    @JoinColumn(name = "HCHopID", referencedColumnName = "HID")
    @ManyToOne(optional = false)
    private Hops hopID;
    @JoinColumn(name = "HopContractV1", referencedColumnName="VID", nullable=true)
    @ManyToOne(optional = true)
    private Vendors hopContractV1;
    @JoinColumn(name = "HopContractV2", referencedColumnName="VID", nullable=true)
    @ManyToOne(optional = true)
    private Vendors hopContractV2;
    @JoinColumn(name = "HopContractV3", referencedColumnName="VID", nullable=true)
    @ManyToOne(optional = true)
    private Vendors hopContractV3;
    @JoinColumn(name = "HopContractV4", referencedColumnName="VID", nullable=true)
    @ManyToOne(optional = true)
    private Vendors hopContractV4;

    public HopContract() {
    }

    public HopContract(Integer hcid) {
        this.hcid = hcid;
    }

    public HopContract(Integer hcid, float hopContractC1, float hopContractC2, float hopContractC3, float hopContractC4, float contractLbsLeft, boolean contractFinished, Date hopContractYear) {
        this.hcid = hcid;
        this.hopContractC1 = hopContractC1;
        this.hopContractC2 = hopContractC2;
        this.hopContractC3 = hopContractC3;
        this.hopContractC4 = hopContractC4;
        this.contractLbsLeft = contractLbsLeft;
        this.contractFinished = contractFinished;
        this.hopContractYear = hopContractYear;
    }

    public Integer getHcid() {
        return hcid;
    }

    public void setHcid(Integer hcid) {
        this.hcid = hcid;
    }

    public float getHopContractC1() {
        return hopContractC1;
    }

    public void setHopContractC1(float hopContractC1) {
        this.hopContractC1 = hopContractC1;
    }

    public float getHopContractC2() {
        return hopContractC2;
    }

    public void setHopContractC2(float hopContractC2) {
        this.hopContractC2 = hopContractC2;
    }

    public float getHopContractC3() {
        return hopContractC3;
    }

    public void setHopContractC3(float hopContractC3) {
        this.hopContractC3 = hopContractC3;
    }

    public float getHopContractC4() {
        return hopContractC4;
    }

    public void setHopContractC4(float hopContractC4) {
        this.hopContractC4 = hopContractC4;
    }

    public float getContractLbsLeft() {
        return contractLbsLeft;
    }

    public void setContractLbsLeft(float contractLbsLeft) {
        this.contractLbsLeft = contractLbsLeft;
    }

    public boolean getContractFinished() {
        return contractFinished;
    }

    public void setContractFinished(boolean contractFinished) {
        this.contractFinished = contractFinished;
    }

    public Date getHopContractYear() {
        return hopContractYear;
    }

    public void setHopContractYear(Date hopContractYear) {
        this.hopContractYear = hopContractYear;
    }

    public Vendors getHopContractV1() {
        return hopContractV1;
    }

    public void setHopContractV1(Vendors hopContractV1) {
        if(hopContractV1.getVid()!=null){
            this.hopContractV1 = hopContractV1;
        }
    }

    public Vendors getHopContractV2() {
        return hopContractV2;
    }

    public void setHopContractV2(Vendors hopContractV2) {
        if(hopContractV2.getVid()!=null){
            this.hopContractV2 = hopContractV2;
        }
    }

    public Vendors getHopContractV3() {
        return hopContractV3;
    }

    public void setHopContractV3(Vendors hopContractV3) {
        if(hopContractV3.getVid()!=null){
            this.hopContractV3 = hopContractV3;
        }
    }

    public Vendors getHopContractV4() {
        return hopContractV4;
    }

    public void setHopContractV4(Vendors hopContractV4) {
        if(hopContractV4.getVid()!=null){
            this.hopContractV4 = hopContractV4;
        }
    }

    public Hops getHCHopID() {
        return hopID;
    }

    public void setHCHopID(Hops hopID) {
        this.hopID = hopID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (hcid != null ? hcid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HopContract)) {
            return false;
        }
        HopContract other = (HopContract) object;
        if ((this.hcid == null && other.hcid != null) || (this.hcid != null && !this.hcid.equals(other.hcid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.HopContract[ hcid=" + hcid + " ]";
    }
    
}
